<div class="page dashboard">
    <div class="container">
        <div class="row">

                <ul class="span3 nav nav-list menu-sidebar">
                    <div style="margin-bottom:10px;" >Selamat Datang, <?php echo anchor(site_url('admin/dashboard'), $this->session->userdata('username')); ?></div>
                    <li class=""><?php echo anchor(site_url('admin/profil/form_update_user/'.$this->session->userdata('user_id')),'Edit Profil');?></li>
                    <li class=""><?php echo anchor(site_url('admin/listing'),'Kelola Properti');?></li>
                    <?php if($level_user == 1){ ?>
                    <li class="aktif"><?php echo anchor(site_url('admin/profil'),'Kelola Agen');?></li>
                    <li class=""><?php echo anchor(site_url('admin/artikel'),'Kelola Artikel');?></li>
                    <li class=""><?php echo anchor('http://localhost/artyproperty/editor/properti_baru.php','Kelola Properti Baru');?></li>
                    <?php } ?>
                </ul>

            <div class="span9 daftar-listing">
                <legend><h5>Daftar Agen</h5></legend>                    
                <?php        
                echo anchor('admin/profil/form_tambah_user', 'Tambah Agen');     

                if ($daftar_user != null) { ?>
                    <!-- //$this->table->set_heading('id', 'nama', 'tipe', 'luas bangunan', 'kmr tidur', 'kmr mandi', 'harga', 'sewa/beli', 'ubah', 'hapus'); -->
                <table class="table table-striped">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>Nama</th>
                                <th>Email</th>
                                <th>Ubah/Hapus</th>
                            </tr>
                        </thead>    
                        <tbody>
                            
                <?php    foreach ($daftar_user->result() as $key => $val) {
                        	$modify_link = anchor('admin/profil/form_update_user/'.$val->user_id,'ubah');
    						$delete_link = anchor('admin/profil/hapus_user/'.$val->user_id,'hapus');
                         	if($val->username != $this->session->userdata('username')){
                         ?>
                        <tr>
                                <td><?php echo $val->user_id; ?></td>
                                <td><?php echo anchor('profil/detail/'.$val->user_id,$val->username); ?></td>
                                <td><?php echo $val->email; ?></td>
                                <td><?php echo $modify_link; ?>|<?php echo $delete_link; ?></td>
                            </tr>
                 <?php   }} ?> 
                    <!-- //echo $this->table->generate(); -->
                </tbody>
            </table>
                <?php } else {
                    echo '</br>daftar user kosong</br>';
                }
                ?>
            </div>
        </div>
    </div>
</div>

<?php
// if($this->session->userdata('level')=='1'){
//     echo anchor('admin/profil/form_tambah_user','Tambah Pengguna');
// }
// $this->table->set_heading('id','nama','email','level','ubah','hapus');
// foreach ($daftar_user->result() as $key=>$val) {
//     $modify_link = anchor('admin/profil/form_update_user/'.$val->user_id,'ubah');
//     $delete_link = anchor('admin/profil/hapus_user/'.$val->user_id,'hapus');

//     if($val->username != $this->session->userdata('username')){
//         $this->table->add_row($val->user_id,$val->username,$val->email,$val->level,$modify_link,$delete_link);
//     }    
// }
// echo $this->table->generate();
?>

